

//
//  U9MatchDetailManager.m
//  U9WatchGame
//
//  Created by uuu9 on 2017/8/31.
//  Copyright © 2017年 UUU9. All rights reserved.
//

#import "U9MatchDetailManager.h"
#import "U9MatchCommonModel.h"
#import "U9MatchNewsListModel.h"
#import "U9MatchListModel.h"
#import "U9MatchBattleRatioModel.h"
#import "U9RecentMatchModel.h"
#import "U9PlayResourcesModel.h"
#import "MatchOverLottleModel.h"
#import "U9ShareModel.h"
#import "U9MatchDetailTabModel.h"

@implementation U9MatchDetailManager


+ (void)setLikeTeamWithMatchID:(NSString *)matchid andTeam:(NSString *)team andCompletionHandle:(void(^)(U9MatchCommonModel *model, NSError *error))completionHandle{
    [self POST:[NSString stringWithFormat:@"%@%@?id=%@&target=%@",Api_URL,kMatchLike,matchid,team]
        parameters:nil
completionHandler:^(id responseObj, NSError *error) {
    U9MatchCommonModel *model = [U9MatchCommonModel mj_objectWithKeyValues:responseObj];
    if (model.error_code != 0) {
        error = [self createError:model.error_msg];
    }
    completionHandle(model,error);
    
}];
}


+ (void)setAttentionMatchWithMatchID:(NSString *)matchid andUserid:(NSString *)uid andSessionid:(NSString *)sessionid andCompletionHandle:(void(^)(U9MatchCommonModel *model, NSError *error))completionHandle{
    [self POSTBase64:[NSString stringWithFormat:@"%@%@?id=%@",Api_URL,kSetAttentionMatch,matchid]
    parameters:[NSString stringWithFormat:@"userid=%@&sessionid=%@",uid,sessionid]
completionHandler:^(id responseObj, NSError *error) {
    U9MatchCommonModel *model = [U9MatchCommonModel mj_objectWithKeyValues:responseObj];
    if (model.error_code != 0) {
        error = [self createError:model.error_msg];
    }
    completionHandle(model,error);
    
}];
}

+ (void)cancelAttentionMatchWithMatchID:(NSString *)matchid andUserid:(NSString *)uid andSessionid:(NSString *)sessionid andCompletionHandle:(void(^)(U9MatchCommonModel *model, NSError *error))completionHandle{
    [self POSTBase64:[NSString stringWithFormat:@"%@%@?id=%@",Api_URL,kCancelAttentionMatch,matchid]
    parameters:[NSString stringWithFormat:@"userid=%@&sessionid=%@",uid,sessionid]
completionHandler:^(id responseObj, NSError *error) {
    U9MatchCommonModel *model = [U9MatchCommonModel mj_objectWithKeyValues:responseObj];
    if (model.error_code != 0) {
        error = [self createError:model.error_msg];
    }
    completionHandle(model,error);
    
}];
}


+ (void)getRecentBattleWithMatchID:(NSString *)matchid andCompletionHandle:(void(^)(U9RecentMatchModel *model, NSError *error))completionHandle{
    [self POST:[NSString stringWithFormat:@"%@%@?id=%@",Api_URL,kGetRecentMatches,matchid]
    parameters:nil
completionHandler:^(id responseObj, NSError *error) {
    U9RecentMatchModel *model = [U9RecentMatchModel mj_objectWithKeyValues:responseObj];
    if (model.error_code != 0) {
        error = [self createError:model.error_msg];
    }
    completionHandle(model,error);
    
}];
}


+ (void)getMatchRatioWithMatchID:(NSString *)matchid andCompletionHandle:(void(^)(U9MatchBattleRatioModel *model, NSError *error))completionHandle{
    [self POST:[NSString stringWithFormat:@"%@%@?id=%@",Api_URL,kGetMatchRatio,matchid]
    parameters:nil
completionHandler:^(id responseObj, NSError *error) {
    U9MatchBattleRatioModel *model = [U9MatchBattleRatioModel mj_objectWithKeyValues:responseObj];
    if (model.error_code != 0) {
        error = [self createError:model.error_msg];
    }
    completionHandle(model,error);
    
}];
}

+ (void)getMatchNewsWithMatchID:(NSString *)matchid andPage:(NSString *)page andCompletionHandle:(void(^)(U9MatchNewsListModel *model, NSError *error))completionHandle{
    [self POST:[NSString stringWithFormat:@"%@%@?id=%@&num=%@",Api_URL,kGetMatchNews,matchid,page]
    parameters:nil
completionHandler:^(id responseObj, NSError *error) {
    U9MatchNewsListModel *model = [U9MatchNewsListModel mj_objectWithKeyValues:responseObj];
    if (model.error_code != 0) {
        error = [self createError:model.error_msg];
    }
    completionHandle(model,error);
    
}];
}


+ (void)getPlayResourcesWithMatchID:(NSString *)matchid andCompletionHandle:(void(^)(U9PlayResourcesModel *model, NSError *error))completionHandle{
    [self POST:[NSString stringWithFormat:@"%@%@?room_id=%@",Api_URL,kGetMatchPlayResources,matchid]
    parameters:nil
completionHandler:^(id responseObj, NSError *error) {
    U9PlayResourcesModel *model = [U9PlayResourcesModel mj_objectWithKeyValues:responseObj];
    if (model.error_code != 0) {
        error = [self createError:model.error_msg];
    }
    completionHandle(model,error);
    
}];
}


+ (void)getVideoResourcesWithMatchID:(NSString *)matchid andCompletionHandle:(void(^)(U9MatchNewsListModel *model, NSError *error))completionHandle{
    [self POST:[NSString stringWithFormat:@"%@%@?id=%@",Api_URL,kGetMatchVideoResources,matchid]
    parameters:nil
completionHandler:^(id responseObj, NSError *error) {
    U9MatchNewsListModel *model = [U9MatchNewsListModel mj_objectWithKeyValues:responseObj];
    if (model.error_code != 0) {
        error = [self createError:model.error_msg];
    }
    completionHandle(model,error);
    
}];
}


+ (void)getMatchOverLottleWithMatchID:(NSString *)matchid andUserid:(NSString *)uid andSessionid:(NSString *)sessionid andCompletionHandle:(void(^)(MatchOverLottleModel *model, NSError *error))completionHandle{
    [self POSTBase64:[NSString stringWithFormat:@"%@%@",Api_URL,kGetMatchOverLottle]
    parameters:[NSString stringWithFormat:@"userid=%@&sessionid=%@&id=%@",uid,sessionid,matchid]
completionHandler:^(id responseObj, NSError *error) {
    MatchOverLottleModel *model = [MatchOverLottleModel mj_objectWithKeyValues:responseObj];
    if (model.error_code != 0) {
        error = [self createError:model.error_msg];
    }
    completionHandle(model,error);
    
}];
}

+ (void)getMatchShareWithMatchID:(NSString *)matchid andCompletionHandle:(void(^)(U9ShareModel *model, NSError *error))completionHandle{
    [self POST:[NSString stringWithFormat:@"%@%@?id=%@",Api_URL,kGetMatchShare,matchid]
          parameters:nil
   completionHandler:^(id responseObj, NSError *error) {
       U9ShareModel *model = [U9ShareModel mj_objectWithKeyValues:responseObj];
       if (model.error_code != 0) {
           error = [self createError:model.error_msg];
       }
       completionHandle(model,error);
       
   }];
}

+ (void)getMatchTabbarWithMatchID:(NSString *)matchid andCompletionHandle:(void(^)(U9MatchDetailTabModel *model, NSError *error))completionHandle{
    [self POST:[NSString stringWithFormat:@"%@%@?id=%@",Api_URL,kMatcheTabbar,matchid]
    parameters:nil
completionHandler:^(id responseObj, NSError *error) {
    U9MatchDetailTabModel *model = [U9MatchDetailTabModel mj_objectWithKeyValues:responseObj];
    if (model.error_code != 0) {
        error = [self createError:model.error_msg];
    }
    completionHandle(model,error);
    
}];
}

+ (void)diffOnlineWithMatchID:(NSString *)matchid andCompletionHandle:(void(^)(U9MatchCommonModel *model, NSError *error))completionHandle{
    [self POST:[NSString stringWithFormat:@"%@%@?id=%@",Api_URL,kDiffOnline,matchid]
    parameters:nil
completionHandler:^(id responseObj, NSError *error) {
    U9MatchCommonModel *model = [U9MatchCommonModel mj_objectWithKeyValues:responseObj];
    if (model.error_code != 0) {
        error = [self createError:model.error_msg];
    }
    completionHandle(model,error);
    
}];
}



@end
